home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / plotting / imagetoo / imagetl1.lha / Imagetool / src+obj / id.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-11  |  3.2 KB  |  114 lines

  1. /* cat > headers/id.h << "EOF" */
  2. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3. /* id.h: header for id.c file                */
  4. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5. /* SCCS information: %W%    %G% - NCSA */
  6.  
  7. #define id_h        1
  8.  
  9. #include "all.h"
  10. #include "newext.h"
  11.  
  12. #define SMALL_FONT "/usr/lib/fonts/fixedwidthfonts/cour.b.18"
  13. #define LARGE_FONT "/usr/lib/fonts/fixedwidthfonts/cour.b.24"
  14.  
  15. #define ID_BG_COLOR     50
  16. #define ID_COLOR1     130
  17. #define ID_COLOR2     180
  18. #define ID_COLOR3     210
  19.  
  20.     static int width, height, xwin, ywin, ystart; 
  21.  
  22. /* EOF */
  23. /* cat > src+obj/id/make_id_symbol.c << "EOF" */
  24. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  25. /* make_id_symbol: make the id symbol            */
  26. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  27. /* SCCS information: %W%    %G% - NCSA */
  28.  
  29. /* #include "id.h" */
  30.  
  31. make_id_symbol ()
  32. {
  33.     struct pixfont *pfsmall, *pflarge;
  34.     char            str[MAXNAMELEN];
  35.  
  36.     width = (int) window_get (canvas, WIN_WIDTH);
  37.     height = (int) window_get (canvas, WIN_HEIGHT);
  38.     xwin = (int) window_get (canvas, WIN_X);
  39.     ywin = (int) window_get (canvas, WIN_Y);
  40.     ystart = height / 7;
  41.  
  42.     if ((pfsmall = pf_open (SMALL_FONT)) == NULL)
  43.         pfsmall = pf_default ();
  44.     if ((pflarge = pf_open (LARGE_FONT)) == NULL)
  45.         pflarge = pf_default ();
  46.  
  47.     paint_bg ();
  48.  
  49.     strcpy (str, "The National Center for Supercomputing Applications");
  50.     put_text (str, pfsmall, 0, ID_COLOR1);
  51.     strcpy (str, "at the University of Illinois at Urbana-Champaign");
  52.     put_text (str, pfsmall, 30, ID_COLOR1);
  53.     strcpy (str, "Presents:");
  54.     put_text (str, pfsmall, 50, ID_COLOR2);
  55.     strcpy (str, "I M A G E T O O L");
  56.     put_text (str, pflarge, 70, ID_COLOR2);
  57.     strcpy (str, "Release 1.1");
  58.     put_text (str, pfsmall, 30, ID_COLOR1);
  59.     strcpy (str, "For the Sun Workstation (TM)");
  60.     put_text (str, pfsmall, 30, ID_COLOR1);
  61.  
  62.     strcpy (str, "(Featuring NCSA HDF support)");
  63.     put_text (str, pfsmall, 50, ID_COLOR2);
  64.     strcpy (str, "Click on cancel button to clear canvas");
  65.     put_text (str, pfsmall, 90, ID_COLOR3);
  66.  
  67.     pf_close (pfsmall);
  68.     pf_close (pflarge);
  69. }
  70. /* EOF */
  71. /* cat > src+obj/id/paint_bg.c << "EOF" */
  72. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  73. /* paint_bg: paint backgournd                */
  74. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  75. /* SCCS information: %W%    %G% - NCSA */
  76.  
  77. /* #include "id.h" */
  78.  
  79. paint_bg ()
  80. {
  81.     Pixwin         *pw = canvas_pixwin (canvas);
  82.  
  83.     pw_writebackground (pw, 0, 0, width, height,
  84.                 PIX_SRC | PIX_COLOR (ID_BG_COLOR));
  85. }
  86. /* EOF */
  87. /* cat > src+obj/id/put_text.c << "EOF" */
  88. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  89. /* put_text: put text                    */
  90. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  91. /* SCCS information: %W%    %G% - NCSA */
  92.  
  93. /* #include "id.h" */
  94.  
  95. put_text (str, pf, yinc, color)
  96.     char           *str;
  97.         /* input: string to print */
  98.     struct pixfont *pf;
  99.         /* input: pointer to data structure of font to use for the string */
  100.     int             yinc;
  101.         /* input: gap in pixels between the last string and this string */
  102.     int             color;
  103.         /* input: color to use how? */
  104. {
  105.     Pixwin         *pw = canvas_pixwin (canvas);
  106.     int             len = strlen (str);
  107.     int             x;
  108.  
  109.     x = xwin + width / 2 - pf->pf_defaultsize.x * len / 2;
  110.     ystart += yinc;
  111.     pw_ttext (pw, x, ystart, PIX_SRC | PIX_COLOR (color), pf, str);
  112. }
  113. /* EOF */
  114.